package com.ms.game.lobby.db;

import com.ms.service.gmtool.log.PlayerLoginLogModel;
import com.xpec.c4.db.dao.PlayerDAO;
import com.xpec.c4.game.utility.GUID;
import com.xpec.c4.service.module.task.TaskAsyncCommand;

public class UpdateDisconnectInfoAsync extends TaskAsyncCommand {

	public GUID playerID;
	
	public GUID sessionId;
	
	public String playerName;
	
	public int userType;

	/** 營運商 id */
	public String venderId;

	/** 子營運商 id */
	public String subVenderId;

	/**
	 * 離線時間
	 */
	public long logoutTime;
	
	@Override
	public void asyncExecute() throws Exception {
		//更新  離線時間
		PlayerDAO.updatePlayerModelLogoutTime(playerID, logoutTime);
		
		//記錄角色登出log
		PlayerLoginLogModel playerLog = new PlayerLoginLogModel();
		playerLog.setSessionId(sessionId.toString());
		playerLog.setGuid(playerID.toString());
		playerLog.setPlayerName(playerName);
		playerLog.setIsLogin(1);
		playerLog.setVenderId(venderId);
		playerLog.setSubVenderId(subVenderId);
		
		getModuleServer().saveDbLog(playerLog);
	}

	@Override
	public void execute() throws Exception {

	}

}
